Repository navigation
Extend tests with a fake Odoo server, and fix bugs they found - #64
Merged
Merged
Conversation
FakeOdoo answers the HTTP requests of odooly by path, per Odoo version: Web API, JSON-2, doc, JSON-RPC, and the 'db', 'common' and 'object' services, also used for the local mode. FakeOdooTestCase creates it.
Changed: Odoo 14 supports 2FA with auth_totp.
Use odoo.sql_db.close_all() at exit.
No Environment.reset() and no 'neutralize_database', and models() for a user from the Reference field. Checked with Odoo 15. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
florentx
force-pushed
the
test/extend-tests
branch
from
November 27, 2026 14:17
f17d00e to
36c50a7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The tests now run against a fake Odoo server, which answers each Odoo version the way the real one does. With it, the Web API, local mode,
has_access,models()andrender_pdf()are tested per version, and the new tests found the bugs fixed below.Tests
tests/_fake_odoo.py:FakeOdooanswers odooly's HTTP requests by path (Web API, JSON-2, doc, JSON-RPC, reports), and serves thedb,commonandobjectservices for local mode. Its behaviour follows the Odoo source of each version.has_access,models()andrender_pdf(), per version.Fixes
render_pdf()with several records: Odoo ignored the context and the options.render_pdf()when several reports match the name: the report with the exact name is selected. Several matches and no exact one raise "Missing report".models()for a user with Odoo 15:ir.modelisn't readable, so the models come from a Reference field.models()for a user in local mode, with Odoo 15 and later: the Odoo exception wasn't caught.ODOOLY_DEBUGenvironment variable.Testing
render_pdf()with Odoo 19, local mode andmodels()with Odoo 15.🤖 Co-authored with Claude Code